package com.stx.servlet.visitor;

import com.stx.mapper.CarMapper;
import com.stx.mapper.VisitorMapper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/*删除访客servlet*/
@WebServlet(urlPatterns = {"/visitorDelete"})
public class VisitorDeleteServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        try {
            Boolean aBoolean = VisitorMapper.delVisitorById(id);
            resp.sendRedirect("/visitorList");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }

}
